<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<meta name="_ctx" th:content="@{/}" />
<title>Index</title>
<style>
	.language{
		width: 1100px;
		margin: 100px auto;
	}
</style>
</head>
<body>
	<div class="language">
	<div th:switch="${#locale.getCountry()}">
		<span th:case="'CN'" >简体中文</span>
		<span th:case="'TW'" >繁體中文</span>
		<span th:case="'US'" >English</span>
		<span th:case="'JP'" >日语</span>
		<span th:case="'KR'" >韩语</span>
	</div>
        <ul class="langBody">
            <li><a href="?lang=zh_CN">简体中文</a></li>
            <li><a href="?lang=zh_TW">繁體中文</a></li>
            <li><a href="?lang=en_US">English</a></li>
            <li><a href="?lang=ja_JP">日语</a></li>
            <li><a href="?lang=ko_KR">韩语</a></li>
        </ul>
	</div>
	<div class="language">
		<div th:text="#{top.lrshuai.text}">asdfSW</div>
		<div th:text="#{top.lrshuai.name}">asdf</div>
		<div th:text="#{top.lrshuai.age}">asdf</div>
		<span th:text="#{message}">ffff</span><br/>
	</div>
	<input type="text" name="url" value="http://localhost:8080/api/test"/><button id="request">请求</button>
	<div>
		<h3>返回结果：</h3>
		<div class="resultData"></div>
	</div>
	<script th:src="@{/js/jquery.min.js}"></script>
	<script th:src="@{/js/common.js}"></script>
<script th:src="@{/jsonview/jquery.json-viewer.js}"></script>
	<script type="text/javascript">
		$(function(){
			 $("#request").click(function(){
				  	var url = $("input[name='url']").val();
				  	$.ajax({
				  		type:"get",
				  		url:url,
				  		cache:false,
				  		dataType:"json",
				  		data:{t_:new Date().getTime()},
				  		success:function(data){
				  			$('.resultData').jsonViewer(data);
				  		},
				  		error:function (jqXHR, textStatus, errorThrown){
				  			alert(textStatus+"\n不支持跨域请求 \n详情请看控制台");
				  		}
				  	});
				  });
		})
	</script>
</body>
</html>